#include <thread>
#include <iostream>
#include <unistd.h>

thread_local int i = 5;

void worker()
{
    i = 6;
    sleep(2);
    std::cout << "worker, &i: " << &i << std::endl;
    std::cout << "worker, i: " << i << std::endl;
}

int main(int argc, char* argv[])
{
    std::thread thread1(worker);
    sleep(5);
    std::cout << "main, &i: " << &i << std::endl;
    std::cout << "main, i: " << i << std::endl;
    thread1.join();
}
